<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: trusted_shops.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

$shop_title = '';

$module_smarty = new Smarty();
$module_smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
$module_smarty->assign('language', $_SESSION['language']);

$order_data = $db->db_query("SELECT
								customers_id,
								customers_name,
								customers_company,
								customers_email_address,
								customers_street_address,
								customers_city,
								customers_postcode,
								customers_country,
								customers_telephone,
								payment_method
							FROM 
								".TABLE_ORDERS."
							WHERE 
								orders_id='".(int)$orders->fields['orders_id']."'");

$module_smarty->assign('shop_title',$shop_title);
$module_smarty->assign('KDNR',$order_data->fields['customers_id']);
$module_smarty->assign('ORDERNR',$orders->fields['orders_id']);
$module_smarty->assign('email',$order_data->fields['customers_email_address']);
$module_smarty->assign('first_name',$_SESSION['customer_first_name']);
$module_smarty->assign('last_name',$_SESSION['customer_last_name']);
$module_smarty->assign('street',$order_data->fields['customers_street_address']);
$module_smarty->assign('city',$order_data->fields['customers_city']);
$module_smarty->assign('zip',$order_data->fields['customers_postcode']);
$module_smarty->assign('phone',$order_data->fields['customers_telephone']);

$country = $db->db_query("SELECT
								countries_iso_code_3
							FROM 
								".TABLE_COUNTRIES."
							WHERE 
								countries_name = '".$order_data->fields['customers_country']."'");

$module_smarty->assign('country',$country->fields['countries_iso_code_3']);


/*
Zuordnung der Zahlungsweisen
Trusted Shops
1 Lastschrift/Bankeinzug   (banktransfer)	
2 Kreditkarte  (cc)	        
4 Rechnung  (invoice)            
5 Nachnahme  (cod)	              
6 Weitere Zahlungsart  (default	)   
7 Vorauskasse / Überweisung (moneyorder)	
10 PayPal  (paypal)	                 
11 Barzahlung bei Abholung  (cash)
16 Giropay (uos_giropay_modul)	 
*/

switch ($order_data->fields['payment_method']) {
	case 'banktransfer': // 1 Lastschrift/Bankeinzug   (banktransfer)
		$payment = 1;
		break;
	
	case 'cc': // 2 Kreditkarte  (cc)
		$payment = 2;
		break;
	
	case 'invoice': // 4 Rechnung  (invoice)
		$payment = 4;
		break;
	
	case 'cod': // 5 Nachnahme  (cod)
		$payment = 5;
		break;
	
	case 'moneyorder': // 7 Vorauskasse / Überweisung (moneyorder)
		$payment = 7;
		break;

	case 'paypal': // 10 PayPal  (paypal)
		$payment = 10;
		break;

	case 'cash': // 11 Barzahlung bei Abholung  (cash)
		$payment = 11;
		break;

	case 'uos_giropay_modul': // 16 Giropay (uos_giropay_modul)
		$payment = 16;
		break;
	
	default:
		$payment = 6;
}

$module_smarty->assign('payment', $payment);

// SELECT total ammount
$total_data = $db->db_query("	SELECT
									value
								FROM 
									".TABLE_ORDERS_TOTAL."
								WHERE
									orders_id = '".(int)$orders->fields['orders_id']."' 
								AND
									class = 'ot_total'");
								
$module_smarty->assign('amount', $total_data->fields['value']);
$module_smarty->assign('curr', $_SESSION['currency']);
$module_smarty->assign('ts_id', TRUSTED_SHOP_NR);

$module_smarty->caching = false;
$module_trusted_shops = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/trusted_shops.html');
$smarty->assign('MODULE_trusted_shops', $module_trusted_shops);